from django.db import models

# Create your models here.

class Student(models.Model):
    SEX_CHOICES = (
        (0, '女'),
        (1, '男')
    )
    name = models.CharField(max_length=30, verbose_name='姓名')  # verbose_name 自动生成的admin后台系统中显示的字段内容
    age = models.IntegerField(verbose_name='年龄', null=True, blank=True)  # null=True 允许为空，blank=True 前端可以不传
    sex = models.IntegerField(verbose_name='性别', null=True, blank=True,
                              choices=SEX_CHOICES)  # choices 添加数值的选项，admin后台会变为下拉框
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')
    is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')

##定义外键字段
    classes = models.ForeignKey('Classes',on_delete=models.CASCADE,verbose_name='班级')

    def delete(self, using=None, keep_parents=False):
        self.is_delete = True
        self.save()

class Classes(models.Model):
    name = models.CharField(max_length=30,verbose_name='班级名')
    slogn = models.TextField(null=True,blank=True,verbose_name='口号')
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')
    is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')

    def delete(self, using=None, keep_parents=False):
        self.is_delete = True
        self.save()

    def __str__(self):
        return self.name



# class message(models.Model):
#     IntoChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     BrokenChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     ManualChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     NeckChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     CrownChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     BodyChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     DiameterChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     StopChoices = (
#         (0,'否'),
#         (1,'是')
#     )
#     DeviceId = models.CharField(primary_key=True,max_length=50,verbose_name = '炉台ID')
#     LotNo = models.CharField(max_length=50,blank=True,null=True,verbose_name='炉次号')
#     CrystalsIndex = models.IntegerField(verbose_name='拉晶次数',null=True,blank=True)
#     RecipeName = models.CharField(verbose_name='熔接开始配方名称',max_length=50,blank=True,null=True)
#     IntoRecast = models.IntegerField(verbose_name='是否首颗',null=True,blank=True,choices=IntoChoices)
#     WeldStartTime = models.DateTimeField(verbose_name='熔接开始时间',null=True,blank=True)
#     WeldStartTemp = models.DecimalField(verbose_name='熔接开始液面温度',max_digits=8,decimal_places=2,null=True,blank=True)
#     WeldMaxTemp = models.DecimalField(verbose_name='熔接液面最高温度',max_digits=8,decimal_places=2,null=True,blank=True)
#     WeldEndTime = models.DateTimeField(verbose_name='熔接结束时间',null=True,blank=True)
#     WeldTime = models.DateTimeField(verbose_name='熔接持续时间',null=True,blank=True)
#     WeldBroken = models.IntegerField(verbose_name='是否熔断',null=True,blank=True,choices=BrokenChoices)
#     NeckStartTime = models.DateTimeField(verbose_name='引晶开始时间',null=True,blank=True)
#     NeckMHTRPowerMntrv = models.DecimalField(verbose_name='引晶开始功率设定',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckCrucPosition = models.DecimalField(verbose_name='引晶开始坩埚位置',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckMaterialWeight = models.DecimalField(verbose_name='引晶开始剩料重量',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckStartTemp = models.DecimalField(verbose_name='引晶开始液面温度',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckLiquidPixel = models.DecimalField(verbose_name='引晶开始液位像素值',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckLiquidDistance = models.DecimalField(verbose_name='引晶开始液口距测量值',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckLength = models.DecimalField(verbose_name='引晶结束晶体长度',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckBrightnessPoint = models.CharField(verbose_name='引晶开始亮度坐标',max_length=50,null=True,blank=True)
#     NeckBrightnessAvg = models.DecimalField(verbose_name='引晶结束灰度平均值',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckLiquidPixelAvg = models.DecimalField(verbose_name='引晶结束平均液位像素值',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckEndTemp = models.DecimalField(verbose_name='引晶结束液面温度',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckAvgSpeed = models.DecimalField(verbose_name='引晶平均拉速',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckLastSpeed = models.DecimalField(verbose_name='引晶最终拉速',decimal_places=2,max_digits=8,null=True,blank=True)
#     NeckEndTime = models.DateTimeField(verbose_name='引晶结束时间',null=True,blank=True)
#     NeckTime = models.DateTimeField(verbose_name='引晶持续时间',null=True,blank=True)
#     NeckManual = models.IntegerField(verbose_name='是否手动引晶',null=True,blank=True,choices=ManualChoices)
#     NeckBroken = models.IntegerField(verbose_name='是否引断',null=True,blank=True,choices=NeckChoices)
#     CrownStartTime = models.DateTimeField(verbose_name='放肩开始时间',null=True,blank=True)
#     CrownStartCrucPosition = models.DecimalField(verbose_name='放肩开始坩埚位置',decimal_places=2,max_digits=8,null=True,blank=True)
#     CrownLiquidPositionPoint = models.CharField(verbose_name='放肩开始液面位置XY坐标',max_length=200,null=True,blank=True)
#     CrownSmallCorner = models.DecimalField(verbose_name='放肩结束小角',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownBigCorner = models.DecimalField(verbose_name='放肩结束大角',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownEndPower = models.DecimalField(verbose_name='放肩结束主加热器功率',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownMaterialWeight = models.DecimalField(verbose_name='放肩结束剩料重量',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownEndDiameter = models.DecimalField(verbose_name='放肩结束晶体直径',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownLiquidDistance = models.DecimalField(verbose_name='放肩开始液口距测量值',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownLength = models.DecimalField(verbose_name='放肩结束晶体长度',max_digits=8,decimal_places=2,null=True,blank=True)
#     CrownEndTime = models.DateTimeField(verbose_name='放肩结束时间', null=True, blank=True)
#     CrownTime = models.DateTimeField(verbose_name='放肩持续时间', null=True, blank=True)
#     CrownDiameterOfSixty = models.DecimalField(verbose_name='放肩长度60时晶体直径', max_digits=8, decimal_places=2, null=True,blank=True)
#     CrownLengthOfSixty = models.DecimalField(verbose_name='放肩长度60时晶体长度', max_digits=8, decimal_places=2, null=True,blank=True)
#     CrownLiquidPixel = models.DecimalField(verbose_name='放肩结束液位像素值', max_digits=8, decimal_places=2, null=True,blank=True)
#     CrownCrystalLengthP = models.DecimalField(verbose_name='放肩结束补偿功率参数', max_digits=8, decimal_places=2, null=True,blank=True)
#     CrownCycle10msTaskRMeltAvg = models.DecimalField(verbose_name='放肩结束瞬时平均液温', max_digits=8, decimal_places=2, null=True,blank=True)
#     CrownRecipeName = models.CharField(verbose_name='放肩结束配方名称',max_length=50,null=True,blank=True)
#     CrownBroken = models.IntegerField(verbose_name='是否放断',null=True,blank=True,choices=CrownChoices)
#     ShoulderStartTime = models.DateTimeField(verbose_name='转肩开始时间',null=True,blank=True)
#     ShoulderStartDiameter = models.DecimalField(verbose_name='转肩开始晶体直径',max_digits=8,decimal_places=2,null=True,blank=True)
#     ShoulderMaxSpeed = models.DecimalField(verbose_name='转肩最大拉速',max_digits=8,decimal_places=2,null=True,blank=True)
#     ShoulderEndTime = models.DateTimeField(verbose_name='转肩结束时间',null=True,blank=True)
#     ShoulderTime = models.DateTimeField(verbose_name='转肩持续时间',null=True,blank=True)
#     ShoulderBroken = models.IntegerField(verbose_name='是否转断',null=True,blank=True)
#     DiameterStartTime  =models.DateTimeField(verbose_name='等径开始时间',null=True,blank=True)
#     DiameterLiquidPixel = models.DecimalField(verbose_name='等径开始液面像素值',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterStartDiameter = models.DecimalField(verbose_name='等径开始晶体直径',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterAvgSpeed = models.DecimalField(verbose_name='等径过程平均拉速',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterStartPower = models.DecimalField(verbose_name='等径开始主加热功率测量值',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterStartCrucPosition = models.DecimalField(verbose_name='等径开始坩埚位置',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterMaterialWeight = models.DecimalField(verbose_name='等径开始剩料重量',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterSpeedOfHundredmm = models.DecimalField(verbose_name='等径长度100时的平均拉速',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterCrystalsRotatingSpeed = models.DecimalField(verbose_name='等径开始晶体转速',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterCrucRotatingSpeed = models.DecimalField(verbose_name='等径开始坩埚转速',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterLiquidDistance = models.DecimalField(verbose_name='等径开始液口距侧量值',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterLiquidPositionPoint = models.CharField(verbose_name='等径开始液面位置XY坐标',max_length=200,null=True,blank=True)
#     DiameterTemperatureDifference = models.DecimalField(verbose_name='等径开始功率总降幅',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterLength = models.DecimalField(verbose_name='等径结束时的晶体长度',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterEndTime = models.DateTimeField(verbose_name='等径结束时间',null=True,blank=True)
#     DiameterTime = models.DateTimeField(verbose_name='等径持续时间',null=True,blank=True)
#     DiameterProMode = models.IntegerField(verbose_name='等径结束的工艺',null=True,blank=True)
#     DiameterBodyBreak = models.IntegerField(verbose_name='等径是否断苞拉料',null=True,blank=True,choices=BodyChoices)
#     DiameterBroken = models.IntegerField(verbose_name='是否断苞',null=True,blank=True,choices=DiameterChoices)
#     IntoStop = models.IntegerField(verbose_name='是否停炉',null=True,blank=True,choices=StopChoices)
#     NeckCycle10msTaskRMeltAvg = models.DecimalField(verbose_name='引晶开始平均液温',max_digits=8,decimal_places=2,null=True,blank=True)
#     WeldCrystalSet = models.DecimalField(verbose_name='引晶开始主加热功率测量值',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterLiquidPixelOfHundredFive = models.DecimalField(verbose_name='等径1500mm的液位像素值',max_digits=8,decimal_places=2,null=True,blank=True)
#     DiameterPowerOfHundredFive = models.DecimalField(verbose_name='等径1500mm的功率',max_digits=8,decimal_places=2,null=True,blank=True)
#     WeldVacuumTime = models.DateTimeField(verbose_name='抽真空时间',null=True,blank=True)
#     WeldFeedTime = models.DateTimeField(verbose_name='第一次复投时间',null=True,blank=True)
#     WeldFeedWeight = models.DecimalField(verbose_name='第一次复投时候的剩料重量',max_digits=8,decimal_places=2,null=True,blank=True)
#     WeldPutTime = models.DateTimeField(verbose_name='最后一次料筒提出时间',null=True,blank=True)
#     WeldPutWeight = models.DecimalField(verbose_name='最后一次料筒提出时的剩料重量', max_digits=8, decimal_places=2, null=True,blank=True)
#     WeldPutCount = models.IntegerField(verbose_name='复投总次数',null=True,blank=True)
#     WeldMaterialWeight = models.DecimalField(verbose_name='熔接开始的剩料量',max_digits=8,decimal_places=2,null=True,blank=True)